<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="path" value="${pageContext.request.contextPath}" />
<!DOCTYPE HTML>
<html>
<jsp:include page="../../common/head.jsp"></jsp:include>
<body>
	<article class="page-container">
		<form id="form-classinfo-add" action="${path}/classinfo/update" method="post"
			class="form form-horizontal">
						<input type="hidden" name="id" value="${classinfo.id}">
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>课程名称：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${classinfo.name}" placeholder="课程名称"
									id="name" name="name">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>学分：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${classinfo.credit}" placeholder="学分"
									id="credit" name="credit">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>学时：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${classinfo.learnHour}" placeholder="学时"
									id="learnHour" name="learnHour">
							</div>
						</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary radius" type="submit"
						value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>
	<jsp:include page="../../common/foot.jsp"></jsp:include>

	<script type="text/javascript">
		$(function() {
			$("#form-classinfo-add").validate({
				rules : {
							name:{
								required : true
							},
							credit:{
								required : true
							},
							learnHour:{
								required : true
							}
				},
				onkeyup : false,
				focusCleanup : true,
				success : "valid",
				submitHandler : function(form) {
					var $form=$(form);
					$.post($form.attr('action'),$form.serialize(),function(result){
						if(checkCode(result)){
							var index = parent.layer.getFrameIndex(window.name);
							parent.layer.msg('修改成功', {
								  icon: 1,
								  time:1000 
							});
							parent.reload();
							parent.layer.close(index);
						}
					},'json').error(function(){
						serverError();
					});
				}
			});
		});
	</script>
</body>
</html>